package com.gxa.controller;

import com.gxa.pojo.WechatSet;
import com.gxa.utils.Constants;
import com.gxa.utils.ResponseData;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created with IntelliJ IDEA.
 * User: tx
 * Date: 2020/11/26 16:52
 * Description:
 * Version: V1.0
 */
@RestController
@Api(value = "微信设置",tags = "微信设置")
@RequestMapping(value = "options")
public class WechatOptionsController {

    @Autowired
    private ResponseData responseData;
    @Autowired(required = false)
    private Constants constants;


    @GetMapping("/updateWechatOptions")
    @ApiOperation(value = "修改微信设置",notes = "根据提交的信息修改微信设置",httpMethod = "GET",response = ResponseData.class)
    @ApiResponses({
            @ApiResponse(code = 200, message = "修改成功"),
            @ApiResponse(code = 400, message = "找不到页面"),
            @ApiResponse(code = 500, message = "修改失败")
    })
    public ResponseData updateWechatOptions(@ApiParam(name = "modId",value = "微信设置id",required = true) int wechatSetId){
        responseData.setCode(Constants.SUCCESS);
        responseData.setMsg("修改成功");
        responseData.setData(wechatSetId);
        return responseData;
    }



    @PostMapping("/queryWechatOptions")
    @ApiOperation(value = "查询微信设置",notes = "根据提交的信息查询微信设置",httpMethod = "POST",response = ResponseData.class)
    @ApiResponses({
            @ApiResponse(code = 200, message = "查询成功"),
            @ApiResponse(code = 400, message = "找不到页面"),
            @ApiResponse(code = 500, message = "查询失败")
    })
    public ResponseData queryWechatOptions(@ApiParam(name = "modSet",value = "微信设置",required = true) WechatSet wechatSet){
        wechatSet.setAppld("CCf46465xjfkaf");
        wechatSet.setUrl("http://baidu.com");
        wechatSet.setToken("CCf46465xjfkaf");
        responseData.setCode(Constants.SUCCESS);
        responseData.setMsg("查询成功");
        responseData.setData(wechatSet);
        return responseData;
    }
}
